//---------------------------------------------------------------------------

#ifndef PaymentTypeBridgeH
#define PaymentTypeBridgeH

#include <dbtables.hpp>
#include "StringUtilities.h"

class TPaymentType : public TObject
{
   public:
      __int64 id;
      AnsiString description;

      TPaymentType();
      TPaymentType( TPaymentType* other);
};

class TPaymentTypeBridge
{
   public:
      TPaymentTypeBridge( TDatabase * database);
      ~TPaymentTypeBridge();

      void Get( __int64 id, TPaymentType* paymentType);
      void Add( TPaymentType* provider);
      void Update( __int64 id, AnsiString newName);
      void Delete( __int64 id);
      void GetPaymentTypes( TStrings * paymentTypes);
      bool InUse( TPaymentType* paymentType);

   private:
      TQuery * qryGet;
      TQuery * qryAdd;
      TQuery * qryUpdate;
      TQuery * qryDelete;
      TQuery * qryGetPaymentTypes;
      TQuery * qryInUse;

      void BuildGetQuery();
      void BuildAddQuery();
      void BuildUpdateQuery();
      void BuildDeleteQuery();
      void BuildGetPaymentTypesQuery();
      void BuildInUseQuery();
};

#endif
